
module.exports = function ($scope, $state, $stateParams,$resource,$modal,items,$modalInstance,FileUploader) {
    console.log(items);
    console.log('上面是items')
    $scope.a=items;
    $scope.applyarr=[
    {name:'区县项目',value:'0'},
    {name:'市级项目',value:'1'},
]
    $scope.imagearr = $scope.a.guide_pdf.split(',');
                    console.log($scope.imagearr);
                    for(var i = 0;i<$scope.imagearr.length;i++){
                        if($scope.imagearr[i]==''){
                            $scope.imagearr.splice(i,1);
                        }
                    }   

    
$scope.image = function(){
				var para = $state.get('app.imageupload');
				//设置上传文件夹，以自己业务命名
				angular.extend(para, {
					resolve : {  
						'dir' : function(){
							return 't1';
						}
					} 
				})
				console.log(para);
				var modalInstance = $modal.open(para);
				modalInstance.opened.then(function() {// 模态窗口打开之后执行的函数  
					console.log('modal is opened');  
				});  
				modalInstance.result.then(function(result) {  
					console.log(result);  
					$scope.imagearr = result;
					// console.log(scope.imagearr);					
                    // $scope.a.project_file=$scope.imagearr.join(',');
                    console.log($scope.imagearr);
                    console.log('上面是imagearr')


				}, function(reason) {  
					console.log(reason);// 点击空白区域，总会输出backdrop  
					// click，点击取消，则会暑促cancel  
					$log.info('Modal dismissed at: ' + new Date());  
				}); 
			};

        $scope.del=function(index){
            $scope.imagearr.splice(index,1);
            $scope.a.guide_pdf=$scope.imagearr;
        }
$scope.submit = function(){
    $scope.a.guide_pdf=$scope.imagearr.join(',');
    var para = {  
        id:$scope.a.id,
        guide_name:$scope.a.guide_name,   
        guide_type:$scope.a.guide_type,
        guide_pdf:$scope.a.guide_pdf
     }

     console.log(para);
     $resource('/api/as/ggc/reviewGuide/create', {}, {}).save(para, function(res){
            // console.log(res);
            if(res.errcode === 0){                      
                alert('修改成功');  
                 $modalInstance.close();
            }else{
                alert(res.errmsg);
            }
        });
}
			


};
